package com.burger.burgerpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.burger.burgerpicturebackend.api.aliyunai.model.CreateOutPaintingTaskResponse;
import com.burger.burgerpicturebackend.model.dto.picture.*;
import com.burger.burgerpicturebackend.model.entity.Picture;
import com.baomidou.mybatisplus.extension.service.IService;
import com.burger.burgerpicturebackend.model.entity.User;
import com.burger.burgerpicturebackend.model.vo.PictureVO;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
* @author zjb13
* @description 针对表【picture(图片)】的数据库操作Service
* @createDate 2025-01-06 23:21:19
*/
public interface PictureService extends IService<Picture> {
    /**
     * 校验图片
     *
     * @param picture
     */
    void validPicture(Picture picture);

//    /**
//     * 上传图片
//     *
//     * @param inputSource          文件输入源
//     * @param pictureUploadRequest
//     * @param loginUser
//     * @return
//     */
//    PictureVO uploadPicture(Object inputSource,
//                            PictureUploadRequest pictureUploadRequest,
//                            User loginUser);

    PictureVO uploadPicture(Object inputSource, PictureUploadRequest pictureUploadRequest, User loginUser);

    PictureVO uploadPictureByUrl(String fileUrl, PictureUploadRequest pictureUploadRequest, User loginUser);

    Integer uploadPictureByBatch(PictureUploadByBatchRequest pictureUploadByBatchRequest, User loginUser);

    PictureVO getPictureVO(Picture picture, HttpServletRequest request);

    Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

    void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

    QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);

    void fillReviewParams(Picture picture, User loginUser);

    void checkPictureAuth(User loginUser, Picture picture);

    void deletePicture(long pictureId, User loginUser);

    void deletePictureByBatch(List<Long> idList, User loginUser);

    void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);

    @Async
    void clearPictureFile(Picture oldPicture);

    void clearPictureFileByBatch(List<Picture> oldPicture);

    List<PictureVO> searchPictureByColor(Long spaceId, String picColor, User loginUser);

    void editPictureByBatch(PictureEditByBatchRequest pictureEditByBatchRequest, User loginUser);

    CreateOutPaintingTaskResponse createPictureOutPaintingTask(CreatePictureOutPaintingTaskRequest createPictureOutPaintingTaskRequest, User loginUser);

    void incrementViewCount(Long pictureId);

    void toggleLike(Long pictureId, Long userId);
}
